﻿using log4net;

namespace La.Code.Log
{
    /// <summary>
    /// 自定义 日志
    /// </summary>
    public class LogCustom
    {

        private static LogEntity2 _logEntity;
        private LogEntity2 BuildMessageMode(object message)
        {
            if (_logEntity == null)
            {
                _logEntity = new LogEntity2();
                _logEntity.UserId = "ccc";
                _logEntity.UserName = "ddd";
                _logEntity.Message = message;
            }
            else
                _logEntity.Message = message;

            return _logEntity;
        }

        private readonly ILog _logger;
        public LogCustom(ILog log)
        {
            _logger = log;
        }
        public void Debug(object message)
        { 
            _logger.Debug(BuildMessageMode(message));
        }
        public void Error(object message)
        {
            _logger.Error(BuildMessageMode(message));
        }
        public void Info(object message)
        {  
            _logger.Info(BuildMessageMode(message));
        }
        public void Warn(object message)
        { 
            _logger.Warn(BuildMessageMode(message));

        }


    }
}
